import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns : BasicColumn[] = [
	{
		title: '创建日期',
		align: "center",
		dataIndex: 'createTime'
	},
	{
		title: '名称',
		align: 'center',
		dataIndex: 'title'
	},
	{
		title: '城市',
		align: "center",
		dataIndex: 'cityId_dictText',
		customRender: ({ text, record }) => (text ? record['name'] : '')
	},
	{
		title: '租户',
		align: "center",
		dataIndex: 'tenantId_dictText'
	},
	{
		title: '人数',
		align: "center",
		sorter: true,
		dataIndex: 'userNum'
	},
	{
		title: '学校类别',
		align: "center",
		dataIndex: 'schoolType_dictText'
	},
	{
		title: '经纬度',
		align: "center",
		dataIndex: 'lotAndLat'
	},
	{
		title: '地址',
		align: "center",
		dataIndex: 'address'
	},
	{
		title: '分销商人数',
		align: "center",
		sorter: true,
		dataIndex: 'shareNum'
	},
	{
		title: '平台人数',
		align: "center",
		sorter: true,
		dataIndex: 'coupleUserNum'
	},
	{
		title: '总销售额',
		align: "center",
		sorter: true,
		dataIndex: 'totalSale'
	},
	{
		title: '总订单数',
		align: "center",
		sorter: true,
		dataIndex: 'totalOrder'
	},
	{
		title: '总取消单数',
		align: "center",
		sorter: true,
		dataIndex: 'totalCancelOrder'
	},
];
//查询数据
export const searchFormSchema : FormSchema[] = [
	{
		label: "租户",
		field: 'tenantId',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "sys_tenant,name,id"
		},
		//colProps: {span: 6},
	},
];
//表单数据
export const formSchema : FormSchema[] = [
	{
		label: '城市',
		field: 'cityId',
		component: 'JTreeDict',
		componentProps: { async: true, parentCode: 'A02' },
	},
	{
		label: '名称',
		field: 'title',
		component: 'Input',
	},
	{
		label: '人数',
		field: 'userNum',
		component: 'InputNumber',
	},
	{
		label: '学校类别',
		field: 'schoolType',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "school_type"
		},
	},
	{
		label: '经纬度',
		field: 'lotAndLat',
		component: 'Input',
		slot: 'lotAndLat'
	},
	{
		label: '地址',
		field: 'address',
		component: 'Input',
	},
	// TODO 主键隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData) : FormSchema[] {
	// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
	return formSchema;
}